package cn.exrick.xboot.modules.source.entity;

import cn.exrick.xboot.base.XbootBaseEntity;
import cn.exrick.xboot.common.utils.NameUtil;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * @author zjl
 * @description TODO
 * @time: 2022/4/15 9:52
 */
@Data
@Accessors(chain = true)
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_users")
@TableName("t_users")
@ApiModel(value = "组内互评表")
public class Users extends XbootBaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "登录名")
    @Column(unique = true, nullable = false)
    @Pattern(regexp = NameUtil.regUsername, message = "登录账号不能包含特殊字符且长度不能>16")
    private String username;

    @ApiModelProperty(value = "密码")
    @NotNull(message = "不能为空")
    private String password;

    @ApiModelProperty(value = "姓名")
    @NotBlank(message = "不能为空")
    @Size(max = 20, message = "姓名长度不能超过20")
    private String name;

    @ApiModelProperty(value = "角色")
    private String role;
}
